/*
* Copyright (c) 2020 - 2025 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/***********************************************************************************************************************
 * Includes
 **********************************************************************************************************************/
#include "r_rsip_primitive.h"
#include "r_rsip_reg.h"
#include "r_rsip_util.h"

/***********************************************************************************************************************
 * Macro definitions
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Typedef definitions
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Private function prototypes
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Private global variables
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Global variables
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Functions
 **********************************************************************************************************************/

RSIP_PRV_PRIMITIVE_FUNC

rsip_ret_t r_rsip_p48f (void)
{
    uint32_t iLoop;
    uint32_t jLoop;
    uint32_t kLoop;
    uint32_t oLoop;
    uint32_t oLoop1;
    uint32_t OFS_ADR;
    (void) iLoop;
    (void) jLoop;
    (void) kLoop;
    (void) oLoop;
    (void) oLoop1;
    (void) OFS_ADR;
    if (0x00000000U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x99a9baeeU), bswap_32big(0x0bed8de7U), bswap_32big(0xe45abee5U),
                       bswap_32big(0xba736f09U));
    }
    else if (0x00000001U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x7b9aa53dU), bswap_32big(0xbcc76a9aU), bswap_32big(0xa8be6b77U),
                       bswap_32big(0xb1f1f009U));
    }
    else if (0x00000002U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x80b00827U), bswap_32big(0xa46a3cb9U), bswap_32big(0x7f0e4411U),
                       bswap_32big(0x7e743d87U));
    }
    else if (0x00000003U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x052dd369U), bswap_32big(0xf86b3090U), bswap_32big(0xde0486e6U),
                       bswap_32big(0xabd6adf6U));
    }
    else if (0x00000004U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x7ad1cc7dU), bswap_32big(0x962ccacfU), bswap_32big(0x248c6c2aU),
                       bswap_32big(0x0377cf8aU));
    }

    r_rsip_func102(bswap_32big(0x8a728f9fU),
                   bswap_32big(0x3f7c301dU),
                   bswap_32big(0xe6390ef2U),
                   bswap_32big(0xc01e34d1U));
    WR1_PROG(REG_14BCH, 0x00000040U);
    WAIT_STS(REG_142CH, 12U, 0U);

    return RSIP_RET_PASS;
}
